<template>
  <div>
    <h1>FastAPI + Vue3 Demo</h1>
    <button @click="fetchData">获取数据</button>
    <p v-if="data">数据: {{ data }}</p>
  </div>
</template>

<script setup>
import { ref } from 'vue'
import axios from 'axios'

const data = ref(null)

const fetchData = async () => {
  try {
    const response = await axios.get('http://192.168.1.118:3100/')
    data.value = response.data
  } catch (error) {
    console.error('请求出错:', error)
  }
}
</script>

<style scoped>
/* 可以添加样式 */
</style>